package cum.kuang.service;

import cum.kuang.dao.UserDao;
import cum.kuang.dao.UserDaoImpl;
import cum.kuang.factory.UserDaoFactory;
import cum.kuang.opoj.User;

public class userServiceImpl implements UserService {
    //实例化所依赖UserDao对象
   // private UserDao dao = new UserDaoImpl();
    //通过工厂获取所依赖的UserDao对象
    private UserDao dao = UserDaoFactory.getInstance();
    /**
     * 声明接口类型引用，和具体实现类
     */
    private UserDao userDao;

    public UserDao getDao() {
        return dao;
    }

    public void setDao(UserDao dao) {
        this.dao = dao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    /**
     * 保存用户信息
     *
     * @param user
     */
    public void save(User user) {

        dao.save(user);
    }

    public void insert(User user) {
        dao.save(user);
    }
}
